<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title>JS 数组</title>
</head>
<body>
    <h1>JS 数组</h1>
    <hr>
    <script>
        var list = ['静静','贱贱','熙熙','哈哈','舒舒','艳艳','波波'];

        // for
        for (var i = 0; i < list.length; i++) {
            console.log(i, list[i]);
        }
        document.write('<hr>');

        // for in
        for (var i in list) {
            console.log(i, list[i]);
        }

        // 遍历对象
        var obj = {name: '卡卡', age: 40, sex: '男'}
        for (var i in obj) {
            console.log(i, obj[i]);
        }
    </script>
    
    

</body>
</html>